﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Ajax_blueDate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext c = HttpContext.Current;
        string dateTimeStr = "";
        string dateTimeAddtime = "";
        string buleball = "";
        string buleballws = "";
        string buleballjo = "";
        string buleballdx = "";
        string buleballsanlu = "";
        string buleballsilu = "";
        int lotteryType = ReadRequest.RequestInt("type");
        int count = ReadRequest.RequestInt("counts");
        int totalCount = 0;
        List <Model.LotteryAnnouncement> modellist=BLL.LotteryAnnouncement.GetPageList_Where(0, count, lotteryType, out totalCount);
        //for (int i = 0; i < modellist.Count; i++)
        for (int i = modellist.Count - 1; i >= 0; i--)
        {
            string flag = modellist[i].LotteryNo.Split('+')[1];
            dateTimeStr += modellist[i].LotteryQS + ",";
            dateTimeAddtime += modellist[i].openTime.Year + "-" + modellist[i].openTime.Month + "-" + modellist[i].openTime.Day + ",";
            buleball += flag + ",";
            buleballws += flag.Substring(flag.Length - 1, 1) + ",";//蓝球尾数
            if (int.Parse(flag) % 2 == 0)
            {
                buleballjo+= "1"+ ","; //双
            }
            else
            {
                buleballjo+= "0"+ ","; //单
            }
            int a = int.Parse(flag);
            if (int.Parse(flag) >= 9 && int.Parse(flag) <=16)
            {
                buleballdx += "0" + ","; //大 
            }
            else if (int.Parse(flag) >= 1 && int.Parse(flag) <=8)
            {
                buleballdx += "1" + ","; //小 
            }
            if (int.Parse(flag)  % 3 == 0)
            {
                buleballsanlu += "0" + ","; //三路0
            }
            else if (int.Parse(flag) % 3 == 1)
            {
                buleballsanlu += "1" + ","; //三路1
            }
            else if (int.Parse(flag) % 3 == 2)
            {
                buleballsanlu += "2" + ","; //三路2
            }

            if (int.Parse(flag) >= 1 && int.Parse(flag) <= 4)
            {
                buleballsilu += "1" + ","; //4路0 
            }
            else if (int.Parse(flag) >= 5 && int.Parse(flag) <= 8)
            {
                buleballsilu += "2" + ","; //4路1 
            }
            else if (int.Parse(flag) >= 9 && int.Parse(flag) <= 12)
            {
                buleballsilu += "3" + ","; //4路2
            }
            else if (int.Parse(flag) >= 13 && int.Parse(flag) <= 16)
            {
                buleballsilu += "4" + ","; //4路3
            }
        }
        dateTimeStr = dateTimeStr.TrimEnd(',');
        dateTimeAddtime = dateTimeAddtime.TrimEnd(',');
        buleball = buleball.TrimEnd(',');
        buleballws = buleballws.TrimEnd(',');
        buleballjo = buleballjo.TrimEnd(',');
        buleballdx = buleballdx.TrimEnd(',');
        buleballsanlu = buleballsanlu.TrimEnd(',');
        buleballsilu = buleballsilu.TrimEnd(',');
        Response.Write(dateTimeStr + "*" + dateTimeAddtime + "*" + buleball + "*" + buleballws + "*" + buleballjo + "*" + buleballdx + "*" + buleballsanlu + "*" + buleballsilu);
        Response.End();
    }
}